//
//  UIBarButtonItem+Extension.swift
//  weibo
//
//  Created by 刁 海瑞 on 16/8/9.
//  Copyright © 2016年 毋磊. All rights reserved.
//

import UIKit

extension UIBarButtonItem{
    
    convenience init(title: String, tarfet: AnyObject?,action: Selector) {
        
        self.init()
        
        let btn = UIButton()
//        添加点击事件
        btn.addTarget(tarfet, action: action, forControlEvents: .TouchUpInside)
        btn.setTitle(title, forState: .Normal)
        btn.setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
        btn.setTitleColor(UIColor.orangeColor(), forState: .Highlighted)
        btn.titleLabel?.font = UIFont.systemFontOfSize(15)
        btn.sizeToFit()
        
        customView = btn
    }
    
    
}

